package com.dtruth.dataflow.util;

import java.io.InputStream;
import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public final class Env extends Properties {
	private static final long serialVersionUID = 1L;
	private static Env instance;

	private static Logger log = MyLoggerFactory.getLogger(Env.class);

	public static Env getInstance() {
		if (instance != null) {
			return instance;
		} else {
			makeInstance();
			return instance;
		}
	}

	// synchronized method
	private static synchronized void makeInstance() {
		if (instance == null) {
			instance = new Env();
		}
	}

	private Env() {
		InputStream setting = getClass().getResourceAsStream(
				"/setting.properties");
		try {
			load(setting);
		} catch (Exception e) {
			log.error(e.getMessage());
		}
	}
}